<?php

/**
 * @name: HOTN AnimeList
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnanimelist/
 */

// Csoport nyelvi file
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_userclass.php");

// Csoportok beállítása
$team_group[e_UC_PUBLIC] = UC_LAN_0;
$team_group[e_UC_MEMBER] = UC_LAN_3;
$team_group[e_UC_ADMIN] = UC_LAN_5;
$team_group[e_UC_MAINADMIN] = UC_LAN_6; 
$sql->db_Select("userclass_classes", "*");
while($row = $sql->db_Fetch())
{
	$team_group[$row['userclass_id']] = $row['userclass_name'];
}

// Admin oldal címének meghatározása
$title .= " \ ".HOTN_ANIMELIST_ADMIN_MENU_OPTIONS_EDIT;

// Adatok
	$data = array(
		"type" => "form",
		"method" => "post",
		"action" =>  e_PLUGIN ."hotn_animelist/Admin/options/admin_options_action.php",
		"hidden" => array("action" => "edit")
	);

// Adatok DATA
	// Forum options
	$data['data'][] = array(
		"type" => "form_title",
		"value" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_TITLE
	);
	$data['data'][] = array(
		"type" => "select",
		"name" => "forum_type",
		"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_TYPE,
		"selected" => $HOTN_ANIMELIST_OPTIONS['forum_type'],
		"value" => array(
						"original" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_TYPE_ORIGINAL,
						"smf" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_TYPE_SMF
					)
	);	
	// SMF forum használata
	if ($HOTN_ANIMELIST_OPTIONS['forum_type'] == "smf")
	{
		// Forum mappája - az e107 gyökér mappából kell kiindúlnia, csak a mappa neve kell, semmi más!
		$data['data'][] = array(
			"type" => "text",
			"name" => "forum_dir",
			"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_DIR,
			"value" => $HOTN_ANIMELIST_OPTIONS['forum_dir']
		);
		
		// Alapértelmezett user. Vele lesz mindenféle művelet végre hajtatva
			// adatok lekérése
			$table = $HOTN_ANIMELIST_FORUM->select("members","`ID_MEMBER`, `memberName`","`ID_GROUP` = '1'");
			foreach($table as $table)
			{
				$smf_user[$table['ID_MEMBER']] = $table['memberName'];
			}
			// Felhasználók rendezése abc sorrendbe
			asort($smf_user,SORT_LOCALE_STRING);
			
			// Kiválasztó megjelenítése
			$data['data'][] = array(
				"type" => "select",
				"name" => "forum_user",
				"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_USER,
				"selected" => $HOTN_ANIMELIST_OPTIONS['forum_user'],
				"value" => $smf_user
			);
			
			$themp = $HOTN_ANIMELIST_FORUM->hotn_animelist_forum_show_topic();
			foreach ($themp as $themp)
			{
				$prefix = "";
				for($i=0;$i<$themp['childLevel'];$i++)
				{
					$prefix .= "&nbsp;&nbsp;&nbsp;&nbsp;";
				}
				$smf_border[$themp['ID_BOARD']] = $prefix.$themp['bName'];
			}
			
			// Aktív project forum
			$data['data'][] = array(
				"type"=> "select",
				"name" => "forum_active",
				"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_ACTIVE,
				"selected" => $HOTN_ANIMELIST_OPTIONS['forum_active'],
				"value" => $smf_border
			);
			
			// Passív project forum
			$data['data'][] = array(
				"type"=> "select",
				"name" => "forum_passive",
				"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_PASSIVE,
				"selected" => $HOTN_ANIMELIST_OPTIONS['forum_passive'],
				"value" => $smf_border
			);
			
			// Tervezett project forum
			$data['data'][] = array(
				"type"=> "select",
				"name" => "forum_planned",
				"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_PLANNED,
				"selected" => $HOTN_ANIMELIST_OPTIONS['forum_planned'],
				"value" => $smf_border
			);
			
			// Eldobott project forum
			$data['data'][] = array(
				"type"=> "select",
				"name" => "forum_dropped",
				"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_DROPPED,
				"selected" => $HOTN_ANIMELIST_OPTIONS['forum_dropped'],
				"value" => $smf_border
			);
			
			// Finished project forum
			$data['data'][] = array(
				"type"=> "select",
				"name" => "forum_finished",
				"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_FORUM_FINISHED,
				"selected" => $HOTN_ANIMELIST_OPTIONS['forum_finished'],
				"value" => $smf_border
			);
	}
	
	// Download options				
	$data['data'][] = array(
		"type" => "form_title",
		"value" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_TITLE
	);
	$data['data'][] = array(
		"type" => "select",
		"name" => "download_type",
		"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_TYPE,
		"selected" => $HOTN_ANIMELIST_OPTIONS['download_type'],
		"value" => array(
						"original" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_TYPE_ORIGINAL,
						"self" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_TYPE_SELF
					)
	);
	// Beépített letöltés kezelő használata
	if ($HOTN_ANIMELIST_OPTIONS['download_type'] == "self")
	{
		$data['data'][] = array(
			"type" => "text",
			"name" => "download_url",
			"value" => $HOTN_ANIMELIST_OPTIONS['download_url'],
			"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_URL
		);
		
		$data['data'][] = array(
			"type" => "select",
			"name" => "download_subtitle",
			"value" => $team_group,
			"selected" => $HOTN_ANIMELIST_OPTIONS['download_subtitle'],
			"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_SUBTITLE
		);
		
		$data['data'][] = array(
			"type" => "select",
			"name" => "download_anime",
			"value" => $team_group,
			"selected" => $HOTN_ANIMELIST_OPTIONS['download_anime'],
			"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_ANIME
		);
		
		$data['data'][] = array(
			"type" => "select",
			"name" => "download_manga",
			"value" => $team_group,
			"selected" => $HOTN_ANIMELIST_OPTIONS['download_manga'],
			"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_DOWNLOAD_MANGA
		);
	}
	
	// Csapat tag csoport beállítása
	$data['data'][] = array(
		"type" => "form_title",
		"value" => HOTN_ANIMELIST_ADMIN_OPTIONS_TEAM_TITLE
	);
	
	$data['data'][] = array(
		"type" => "select",
		"name" => "team_group",
		"text" => HOTN_ANIMELIST_ADMIN_OPTIONS_TEAM_GROUP,
		"selected" => $HOTN_ANIMELIST_OPTIONS['team_group'],
		"value" => $team_group
	);
	
	
	$data['data'][] = array(
		"type" => "submit",
		"value" => HOTN_ANIMELIST_ADMIN_FORM_SAVE 
	);


// Admin oldal tartalmának megjelenítése
$text = "";
$text .= "<div style='text-align: center;'>".$HOTN_ANIMELIST_FORM->show_form($data)."</div>";
?>